package typeCheck;

import java.util.LinkedHashMap;

public class StructType extends Type {

    private LinkedHashMap<String, Type> attributes;

    private LinkedHashMap<String, Type> methods;

    private int filedNum;

    public StructType(String name) {
        super(name, TypeEnum.STRUCT);
        this.filedNum = 0;
        this.attributes = new LinkedHashMap<>();
        this.methods = new LinkedHashMap<>();
    }

    public int getFiledNum() {
        return this.filedNum;
    }

    public void setFiledNum(int filedNum) {
        this.filedNum = filedNum;
    }

    public LinkedHashMap<String, Type> getAttributes() {
        return this.attributes;
    }

    public void addAttribute(Type type) {
        this.attributes.put(type.name, type);
    }

    public LinkedHashMap<String, Type> getMethods() {
        return this.methods;
    }

    public void addMethod(Type type) {
        this.methods.put(type.name, type);
    }
}
